Skip to content

CYF London | Fatma Arslantas | Module-Data-Groups | Week 2 #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AFatmaa
Copy link

@AFatmaa AFatmaa commented Dec 16, 2024

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@AFatmaa AFatmaa added the Needs Review Participant to add when requesting review label Dec 16, 2024
@halilibrahimcelik halilibrahimcelik self-requested a review December 28, 2024 17:55
@halilibrahimcelik halilibrahimcelik added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Participant to add when requesting review labels Dec 28, 2024
if (typeof obj !== "object" || obj === null || Array.isArray(obj)) {
return false;
}
// 〰️ Using hasOwnProperty to check if the key exists directly on the object

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job verifying the object parameter types in the contains function, and you've successfully met all the task requirements!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @halilibrahimcelik,

Thank you for the feedback! I’m glad to hear that. Let me know if there’s anything else I can improve. 🤗

// 〰️ Example: 'John%20Doe' -> 'John Doe', '5%25' -> '5%'
// 〰️ rawKey || "" ensures that if rawKey is undefined, null, or empty, it returns to an empty string.
const key = decodeURIComponent(rawKey || "");
const value = decodeURIComponent(rawValue.join("=") || "");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you demonstrates a solid understanding of value-key pair parsing. Maybe in order to enhance test cases, you can also add dublicate test case for keys i.e "key=value1&key=value2" something like this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your feedback @halilibrahimcelik!

I've updated the implementation to handle duplicate keys by storing their values in an array. Additionally, I’ve added a test case to validate this behavior, ensuring that query strings like key=value1&key=value2 are correctly parsed into { key: ["value1", "value2"] }. I hadn’t considered this, but your suggestion helped improve my code. Thanks again!

Let me know if there’s anything else I can improve. 🙌

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm glad to hear that! It’s a niche case, and in a real-world scenario, it’s unlikely to have two different values with the same key. However, it’s a good challenge, keep up the good work! Cheers 🎉

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 🤗

@AFatmaa AFatmaa added the Complete Volunteer to add when work is complete and review comments have been addressed label Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Volunteer to add when work is complete and review comments have been addressed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants